/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pb138.videodes.entity;

import java.util.HashSet;
import java.util.Set;

/**
 * This class represents Movie entity.
 *
 * @author pseudo
 */
public class Movie{

    String name;
    String id;    
    String director = null;
    Integer year = null;
    String country = null;
    Set<String> actors = new HashSet<String>();
    Set<Genre> genres = new HashSet<Genre>();
    
    public Set<String> getActors() {
	return actors;
    }

    public String getId() {
	return id;
    }

    public void setId(String id) {
	this.id = id;
    }

    public Set<Genre> getGenres() {
	return genres;
    }

    public void setGenres(Set<Genre> genres) {
	this.genres = genres;
    }
    
    public void setActors(Set<String> actors) {
	this.actors = actors;
    }

    public String getCountry() {
	return country;
    }

    public void setCountry(String country) {
	this.country = country;
    }

    public String getDirector() {
	return director;
    }

    public void setDirector(String director) {
	this.director = director;
    }

    public String getName() {
	return name;
    }

    public void setName(String name) {
	this.name = name;
    }

    public Integer getYear() {
	return year;
    }

    public void setYear(Integer year) {
	this.year = year;
    }

    /**
     * Two movies are the same if they have the same name AND year.
     * 
     * @param obj the object that is being compared to this object.
     * @return TRUE, if two objects have the same name AND year, otherwise FALSE.
     */
    @Override
    public boolean equals(Object obj) {
	if (obj == null) {
	    return false;
	}
	if (getClass() != obj.getClass()) {
	    return false;
	}
	final Movie other = (Movie) obj;
	if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
	    return false;
	}
	if (this.year != other.year && (this.year == null || !this.year.equals(other.year))) {
	    return false;
	}
	return true;
    }

    @Override
    public int hashCode() {
	int hash = 5;
	hash = 97 * hash + (this.name != null ? this.name.hashCode() : 0);
	hash = 97 * hash + (this.year != null ? this.year.hashCode() : 0);
	return hash;
    }
    

    
    @Override
    public String toString() {
        return this.name + " (" + this.year + ")";
    }

}
